from flask import make_response
from flask_restful import Api
from werkzeug.wrappers import Response

from redash.handlers.alerts import (
    AlertListResource,
    AlertResource,
    AlertNoreadResource,
    AlertReadResource,
    AlertMuteResource,
    AlertSubscriptionListResource,
    AlertSubscriptionResource,
)
from redash.handlers.base import org_scoped_rule
from redash.handlers.dashboards import (
    DashboardFavoriteListResource,
    DashboardListResource,
    DashboardResource,
    DashboardShareResource,
    DashboardTagsResource,
    PublicDashboardResource,
)
from redash.handlers.data_sources import (
    DataSourceListResource,
    DataSourcePauseResource,
    DataSourceResource,
    DataSourceSchemaResource,
    DataSourceTestResource,
    DataSourceTypeListResource,
)
from redash.handlers.databricks import (
    DatabricksDatabaseListResource,
    DatabricksSchemaResource,
    DatabricksTableColumnListResource,
)
from redash.handlers.destinations import (
    DestinationListResource,
    DestinationResource,
    DestinationTypeListResource,
)
from redash.handlers.events import EventsResource
from redash.handlers.favorites import DashboardFavoriteResource, QueryFavoriteResource
from redash.handlers.groups import (
    GroupDataSourceListResource,
    GroupDataSourceResource,
    GroupListResource,
    GroupMemberListResource,
    GroupMemberResource,
    GroupResource,
)
from redash.handlers.permissions import (
    CheckPermissionResource,
    ObjectPermissionsListResource,
)
from redash.handlers.queries import (
    MyQueriesResource,
    QueryArchiveResource,
    QueryFavoriteListResource,
    QueryForkResource,
    QueryListResource,
    QueryRecentResource,
    QueryRefreshResource,
    QueryResource,
    QuerySearchResource,
    QueryTagsResource,
    QueryRegenerateApiKeyResource,
)
from redash.handlers.query_results import (
    JobResource,
    QueryResultDropdownResource,
    QueryDropdownsResource,
    QueryResultListResource,
    QueryResultResource,
)
from redash.handlers.query_snippets import (
    QuerySnippetListResource,
    QuerySnippetResource,
)
from redash.handlers.settings import OrganizationSettings
from redash.handlers.users import (
    UserDisableResource,
    UserInviteResource,
    UserListResource,
    UserRegenerateApiKeyResource,
    UserResetPasswordResource,
    UserResource,
    UserActiveResource,
    UserdeleteResource,
)
from redash.handlers.visualizations import (
    VisualizationListResource,
    VisualizationResource,
)
from redash.handlers.widgets import WidgetListResource, WidgetResource
from redash.utils import json_dumps

from redash.handlers.enums import (
    EnumResource,
    EnumItemsResource,
    EnumAllResource,
    EnumdeleteResource,
    EnumcodeResource,
)
from redash.handlers.globalsetting import (
    GlobalSettingNewResource,
    GlobalSettingResource,
    GlobalSettingListResource,
)
from redash.handlers.orgunit import (
    OrgUnitListResource,
    OrgUnitListActiveResource,
    OrgUnitResource,
    OrgUnitdeleteResource,
    OrgUnitActiveResource,
    OrgUnitSelectResource,
    OrgUnitListnewResource,
)

from redash.handlers.workflow import (
    WorkflowResource,
    WorkfloweditResource,
    WorkflowmessageResource,
    WorkflowListResource,
    WorkflowNewResource,
    WorkflowUpdateResource,
    WorkflowUpdatedeleteResource,
    WorkflowcheckListResource,
    WorkflowcheckmessagResource,
)
from redash.handlers.workflow_bill_state import (
    Workflow_bill_stateNewResource,
    Workflow_bill_stateResource,
    Workflow_bill_statedeleteResource,
    Workflow_bill_stateListResource,
)
from redash.handlers.workflow_transition import (
    Workflow_transitionNewResource,
    Workflow_transitionResource,
    Workflow_transitiondeleteResource,
    Workflow_transitionListResource,
)
from redash.handlers.workflow_state import (
    Workflow_stateNewResource,
    Workflow_stateResource,
    Workflow_statedeleteResource,
    Workflow_stateListResource,
    Workflow_userListResource,
    Workflow_colListResource,
)
from redash.handlers.tabletype import (
    TabletypeNewResource,
    TabletypeResource,
    TabletypeListResource,
)
from redash.handlers.upload import (
    Uploadfile,
    Downloadfile,
    Removefile,
    ImportExcelResource,
)
from redash.handlers.attaches import (
    AttachesNewResource,
    AttachesResource,
    AttachesListResource,
    AttachesListAllResource,
    AttachesListSelResource,
)
from redash.handlers.orgstruct import (
    OrgStructListResource,
    OrgStructResource,
    OrgStructMatchResource,
    OrgStructdeleteResource,
)
from redash.handlers.customers import (
    CustomerResource,
    CustomerListResource,
    CustomerNewResource,
    CustomersResource,
    CustomersdeleteResource,
    CustomersListResource,
    DepartmentListResource,
    yusuancodeListResource,
    CustomerUserListResource,
)
from redash.handlers.employee import (
    EmployeeNewResource,
    EmployeeResource,
    EmployeedeleteResource,
    EmployeeListResource,
    EmployeeBatchMoveResource,
    EmployeeSelListResource,
)
from redash.handlers.employeechange import (
    EmployeeChangeNewResource,
    EmployeeChangeResource,
    EmployeeChangeDeleteResource,
    EmployeeChangeListResource,
)
from redash.handlers.employeeactivity import (
    EmployeeActivityNewResource,
    EmployeeActivityResource,
    EmployeeActivityDeleteResource,
    EmployeeActivityListResource,
    EmployeeActivityByEmployeeidResource,
)
from redash.handlers.payment import (
    PaymentNewResource,
    PaymentResource,
    PaymentdeleteResource,
    PaymentListResource,
    PaymentUnInListResource,
    PaymentUnOutListResource,
)
from redash.handlers.paymentactivity import (
    PaymentActivityNewResource,
    PaymentActivityResource,
    PaymentActivityDeleteResource,
    PaymentActivityListResource,
    PaymentActivityunListResource,
)
from redash.handlers.queryshowfield import (
    QueryShowFieldNewResource,
    QueryShowFieldResource,
    QueryShowFieldDeleteResource,
    QueryShowFieldListResource,
    QueryShowFieldCodeResource,
)
from redash.handlers.project import (
    ProjectNewResource,
    ProjectResource,
    ProjectBytstatusResource,
    ProjectdeleteResource,
    ProjectListResource,
    ProjectSelListResource,
)
from redash.handlers.projectdetail import (
    ProjectDetailNewResource,
    ProjectDetailResource,
    ProjectDetaildeleteResource,
    ProjectDetailListResource,
    ProjectDetailBatchAddResource,
    ProjectDetailSelListResource,
    ProjectDetailEmployeeListResource,
)
class ApiExt(Api):
    def add_org_resource(self, resource, *urls, **kwargs):
        urls = [org_scoped_rule(url) for url in urls]
        return self.add_resource(resource, *urls, **kwargs)


api = ApiExt()


@api.representation("application/json")
def json_representation(data, code, headers=None):
    # Flask-Restful checks only for flask.Response but flask-login uses werkzeug.wrappers.Response
    if isinstance(data, Response):
        return data
    resp = make_response(json_dumps(data), code)
    resp.headers.extend(headers or {})
    return resp


api.add_org_resource(AlertResource, "/api/alerts/<alert_id>", endpoint="alert")
api.add_org_resource(
    AlertMuteResource, "/api/alerts/<alert_id>/mute", endpoint="alert_mute"
)
api.add_org_resource(
    AlertSubscriptionListResource,
    "/api/alerts/<alert_id>/subscriptions",
    endpoint="alert_subscriptions",
)
api.add_org_resource(
    AlertSubscriptionResource,
    "/api/alerts/<alert_id>/subscriptions/<subscriber_id>",
    endpoint="alert_subscription",
)
api.add_org_resource(AlertListResource, "/api/alerts", endpoint="alerts")
api.add_org_resource(AlertNoreadResource, "/api/alerts/noread", endpoint="alert_noread")
api.add_org_resource(AlertReadResource, "/api/alerts/read/<alert_id>/<type>", endpoint="alert_read")

api.add_org_resource(DashboardListResource, "/api/dashboards", endpoint="dashboards")
api.add_org_resource(
    DashboardResource, "/api/dashboards/<dashboard_id>", endpoint="dashboard"
)
api.add_org_resource(
    PublicDashboardResource,
    "/api/dashboards/public/<token>",
    endpoint="public_dashboard",
)
api.add_org_resource(
    DashboardShareResource,
    "/api/dashboards/<dashboard_id>/share",
    endpoint="dashboard_share",
)

api.add_org_resource(
    DataSourceTypeListResource, "/api/data_sources/types", endpoint="data_source_types"
)
api.add_org_resource(
    DataSourceListResource, "/api/data_sources", endpoint="data_sources"
)
api.add_org_resource(
    DataSourceSchemaResource, "/api/data_sources/<data_source_id>/schema"
)
api.add_org_resource(
    DatabricksDatabaseListResource, "/api/databricks/databases/<data_source_id>"
)
api.add_org_resource(
    DatabricksSchemaResource,
    "/api/databricks/databases/<data_source_id>/<database_name>/tables",
)
api.add_org_resource(
    DatabricksTableColumnListResource,
    "/api/databricks/databases/<data_source_id>/<database_name>/columns/<table_name>",
)
api.add_org_resource(
    DataSourcePauseResource, "/api/data_sources/<data_source_id>/pause"
)
api.add_org_resource(DataSourceTestResource, "/api/data_sources/<data_source_id>/test")
api.add_org_resource(
    DataSourceResource, "/api/data_sources/<data_source_id>", endpoint="data_source"
)

api.add_org_resource(GroupListResource, "/api/groups", endpoint="groups")
api.add_org_resource(GroupResource, "/api/groups/<group_id>", endpoint="group")
api.add_org_resource(
    GroupMemberListResource, "/api/groups/<group_id>/members", endpoint="group_members"
)
api.add_org_resource(
    GroupMemberResource,
    "/api/groups/<group_id>/members/<user_id>",
    endpoint="group_member",
)
api.add_org_resource(
    GroupDataSourceListResource,
    "/api/groups/<group_id>/data_sources",
    endpoint="group_data_sources",
)
api.add_org_resource(
    GroupDataSourceResource,
    "/api/groups/<group_id>/data_sources/<data_source_id>",
    endpoint="group_data_source",
)

api.add_org_resource(EventsResource, "/api/events", endpoint="events")

api.add_org_resource(
    QueryFavoriteListResource, "/api/queries/favorites", endpoint="query_favorites"
)
api.add_org_resource(
    QueryFavoriteResource, "/api/queries/<query_id>/favorite", endpoint="query_favorite"
)
api.add_org_resource(
    DashboardFavoriteListResource,
    "/api/dashboards/favorites",
    endpoint="dashboard_favorites",
)
api.add_org_resource(
    DashboardFavoriteResource,
    "/api/dashboards/<object_id>/favorite",
    endpoint="dashboard_favorite",
)

api.add_org_resource(QueryTagsResource, "/api/queries/tags", endpoint="query_tags")
api.add_org_resource(
    DashboardTagsResource, "/api/dashboards/tags", endpoint="dashboard_tags"
)

api.add_org_resource(
    QuerySearchResource, "/api/queries/search", endpoint="queries_search"
)
api.add_org_resource(
    QueryRecentResource, "/api/queries/recent", endpoint="recent_queries"
)
api.add_org_resource(
    QueryArchiveResource, "/api/queries/archive", endpoint="queries_archive"
)
api.add_org_resource(QueryListResource, "/api/queries", endpoint="queries")
api.add_org_resource(MyQueriesResource, "/api/queries/my", endpoint="my_queries")
api.add_org_resource(
    QueryRefreshResource, "/api/queries/<query_id>/refresh", endpoint="query_refresh"
)
api.add_org_resource(QueryResource, "/api/queries/<query_id>", endpoint="query")
api.add_org_resource(
    QueryForkResource, "/api/queries/<query_id>/fork", endpoint="query_fork"
)
api.add_org_resource(
    QueryRegenerateApiKeyResource,
    "/api/queries/<query_id>/regenerate_api_key",
    endpoint="query_regenerate_api_key",
)

api.add_org_resource(
    ObjectPermissionsListResource,
    "/api/<object_type>/<object_id>/acl",
    endpoint="object_permissions",
)
api.add_org_resource(
    CheckPermissionResource,
    "/api/<object_type>/<object_id>/acl/<access_type>",
    endpoint="check_permissions",
)

api.add_org_resource(
    QueryResultListResource, "/api/query_results", endpoint="query_results"
)
api.add_org_resource(
    QueryResultDropdownResource,
    "/api/queries/<query_id>/dropdown",
    endpoint="query_result_dropdown",
)
api.add_org_resource(
    QueryDropdownsResource,
    "/api/queries/<query_id>/dropdowns/<dropdown_query_id>",
    endpoint="query_result_dropdowns",
)
api.add_org_resource(
    QueryResultResource,
    "/api/query_results/<query_result_id>.<filetype>",
    "/api/query_results/<query_result_id>",
    "/api/queries/<query_id>/results",
    "/api/queries/<query_id>/results.<filetype>",
    "/api/queries/<query_id>/results/<query_result_id>.<filetype>",
    endpoint="query_result",
)
api.add_org_resource(
    JobResource,
    "/api/jobs/<job_id>",
    "/api/queries/<query_id>/jobs/<job_id>",
    endpoint="job",
)

api.add_org_resource(UserListResource, "/api/users", endpoint="users")
api.add_org_resource(UserResource, "/api/users/<user_id>", endpoint="user")
api.add_org_resource(UserdeleteResource, "/api/users/delete/<user_id>", endpoint="userdelete")

api.add_org_resource(
    UserInviteResource, "/api/users/<user_id>/invite", endpoint="user_invite"
)
api.add_org_resource(
    UserResetPasswordResource,
    "/api/users/<user_id>/reset_password",
    endpoint="user_reset_password",
)
api.add_org_resource(
    UserRegenerateApiKeyResource,
    "/api/users/<user_id>/regenerate_api_key",
    endpoint="user_regenerate_api_key",
)
api.add_org_resource(
    UserDisableResource, "/api/users/<user_id>/disable", endpoint="user_disable"
)
api.add_org_resource(
    UserActiveResource, "/api/users/<user_id>/active", endpoint="user_active"
)
api.add_org_resource(
    VisualizationListResource, "/api/visualizations", endpoint="visualizations"
)
api.add_org_resource(
    VisualizationResource,
    "/api/visualizations/<visualization_id>",
    endpoint="visualization",
)

api.add_org_resource(WidgetListResource, "/api/widgets", endpoint="widgets")
api.add_org_resource(WidgetResource, "/api/widgets/<int:widget_id>", endpoint="widget")

api.add_org_resource(
    DestinationTypeListResource, "/api/destinations/types", endpoint="destination_types"
)
api.add_org_resource(
    DestinationResource, "/api/destinations/<destination_id>", endpoint="destination"
)
api.add_org_resource(
    DestinationListResource, "/api/destinations", endpoint="destinations"
)

api.add_org_resource(
    QuerySnippetResource, "/api/query_snippets/<snippet_id>", endpoint="query_snippet"
)
api.add_org_resource(
    QuerySnippetListResource, "/api/query_snippets", endpoint="query_snippets"
)

api.add_org_resource(
    OrganizationSettings, "/api/settings/organization", endpoint="organization_settings"
)

api.add_org_resource(
    EnumResource, "/api/enums/<code>", endpoint="enum"
)
api.add_org_resource(
    EnumdeleteResource, "/api/enums/delete/<code>", endpoint="enumdelete"
)

api.add_org_resource(
    EnumItemsResource, "/api/enums/items/<code>", endpoint="enum_items"
)
api.add_org_resource(
    EnumAllResource, "/api/enums/all", endpoint="enum_all"
)
api.add_org_resource(
    EnumcodeResource, "/api/enums/code", endpoint="enum_code"
)

api.add_org_resource(
    GlobalSettingNewResource, "/api/globalsetting", endpoint="globalsettingnew"
)
api.add_org_resource(
    GlobalSettingResource, "/api/globalsetting/<globalsetting_id>", endpoint="globalsetting"
)
api.add_org_resource(
    GlobalSettingListResource, "/api/globalsetting/list", endpoint="globalsettinglist"
)
api.add_org_resource(
    OrgUnitListResource, "/api/orgunit", endpoint="orgunits"
)

api.add_org_resource(
    OrgUnitListnewResource, "/api/orgunitlist", endpoint="orgunitlist"
)

api.add_org_resource(
    OrgUnitListActiveResource, "/api/orgunitactive", endpoint="orgunitsactive"
)
api.add_org_resource(
    OrgUnitResource, "/api/orgunit/<orgunit_id>", endpoint="orgunit"
)
api.add_org_resource(
    OrgUnitdeleteResource, "/api/orgunit/delete/<orgunit_id>", endpoint="orgunitdelete"
)

api.add_org_resource(
    OrgUnitActiveResource, "/api/orgunit/active/<orgunit_id>", endpoint="orgunit_active"
)
api.add_org_resource(
    OrgUnitSelectResource, "/api/orgunit/select/<orgstruct_id>", endpoint="orgunit_select"
)

api.add_org_resource(
    Workflow_bill_stateNewResource, "/api/workflow_bill_state", endpoint="workflow_bill_statenew"
)
api.add_org_resource(
    Workflow_bill_stateResource, "/api/workflow_bill_state/<workflow_bill_state_id>", endpoint="workflow_bill_state"
)
api.add_org_resource(
    Workflow_bill_statedeleteResource, "/api/workflow_bill_state/delete/<workflow_bill_state_id>", endpoint="workflow_bill_statedelete"
)

api.add_org_resource(
    Workflow_bill_stateListResource, "/api/workflow_bill_state/list", endpoint="workflow_bill_statelist"
)
api.add_org_resource(
    Workflow_transitionNewResource, "/api/workflow_transition", endpoint="workflow_transitionnew"
)
api.add_org_resource(
    Workflow_transitionResource, "/api/workflow_transition/<workflow_transition_id>", endpoint="workflow_transition"
)
api.add_org_resource(
    Workflow_transitiondeleteResource, "/api/workflow_transition/delete/<workflow_transition_id>", endpoint="workflow_transitiondelete"
)

api.add_org_resource(
    Workflow_transitionListResource, "/api/workflow_transition/list", endpoint="workflow_transitionlist"
)
api.add_org_resource(
    Workflow_stateNewResource, "/api/workflow_state", endpoint="workflow_statenew"
)
api.add_org_resource(
    Workflow_stateResource, "/api/workflow_state/<workflow_state_id>", endpoint="workflow_state"
)
api.add_org_resource(
    Workflow_statedeleteResource, "/api/workflow_state/delete/<workflow_state_id>", endpoint="workflow_statedelete"
)

api.add_org_resource(
    Workflow_stateListResource, "/api/workflow_state/list", endpoint="workflow_statelist"
)
api.add_org_resource(
    Workflow_userListResource, "/api/workflow_user/list", endpoint="workflow_userlist"
)
api.add_org_resource(
    Workflow_colListResource, "/api/workflow_col/list", endpoint="workflow_collist"
)
api.add_org_resource(
    TabletypeNewResource, "/api/tabletype", endpoint="tabletypenew"
)
api.add_org_resource(
    TabletypeResource, "/api/tabletype/<tabletype_id>", endpoint="tabletype"
)
api.add_org_resource(
    TabletypeListResource, "/api/tabletype/list", endpoint="tabletypelist"
)

api.add_org_resource(
    WorkflowResource, "/api/workflow/check", endpoint="workflowcheck"
)
api.add_org_resource(
    WorkfloweditResource, "/api/workflow/edit/<bill>/<billtype>/<billid>/<userid>", endpoint="workflowcheckedit"
)
api.add_org_resource(
    WorkflowmessageResource, "/api/workflow/message/<bill>/<billid>/<bill_type>/<orgunitid>", endpoint="workflowmessage"
)
api.add_org_resource(
    WorkflowListResource, "/api/workflow/list", endpoint="workflowlist"
)
api.add_org_resource(
    WorkflowcheckListResource, "/api/workflow/checkList", endpoint="workflowchecklist"
)
api.add_org_resource(
    WorkflowcheckmessagResource, "/api/workflow/checkmessag", endpoint="workflowcheckmessag"
)

api.add_org_resource(
    WorkflowNewResource, "/api/workflow", endpoint="workflownew"
)
api.add_org_resource(
    WorkflowUpdateResource, "/api/workflow/<workflow_id>", endpoint="workflow"
)
api.add_org_resource(
    WorkflowUpdatedeleteResource, "/api/workflow/delete/<workflow_id>", endpoint="workflowdelete"
)

api.add_org_resource(
    Uploadfile, "/api/upload/uploadfile/<sourcetype>/<sourceid>/<types>", endpoint="uploadfile"
)

api.add_org_resource(
    Downloadfile, "/api/upload/downloadfile", endpoint="downloadfile"
)
api.add_org_resource(
    Removefile, "/api/upload/removefile/<sourcetype>/<sourceid>/<uid>", endpoint="removefile"
)

api.add_org_resource(
    ImportExcelResource, "/api/upload/importexcel/<tablename>/<openseapool>", endpoint="importexcel"
)

api.add_org_resource(
    AttachesNewResource, "/api/attaches", endpoint="attachesnew"
)
api.add_org_resource(
    AttachesResource, "/api/attaches/<source_id>/<source_type>", endpoint="attaches"
)
api.add_org_resource(
    AttachesListResource, "/api/attaches/list", endpoint="attacheslist"
)
api.add_org_resource(
    AttachesListAllResource, "/api/attaches/listall", endpoint="attacheslistall"
)
api.add_org_resource(
    AttachesListSelResource, "/api/attaches/listsel", endpoint="attacheslistsel"
)
api.add_org_resource(
    OrgStructListResource, "/api/orgstructs/<orgstruct_enum>", endpoint="orgstructs"
)
api.add_org_resource(
    OrgStructResource, "/api/orgstruct/<orgstruct_id>", endpoint="orgstruct"
)
api.add_org_resource(
    OrgStructdeleteResource, "/api/orgstruct/delete/<orgstruct_id>", endpoint="orgstructdelete"
)

api.add_org_resource(
    OrgStructMatchResource, "/api/orgstruct/match/<orgstruct_enum>", endpoint="orgstruct_match"
)

api.add_org_resource(
    CustomerResource, "/api/customer/<code>", endpoint="customer"
)
api.add_org_resource(
    CustomersListResource, "/api/customers/list/<bytstatus>", endpoint="customerslistbytstatus"
)

api.add_org_resource(
    CustomerNewResource, "/api/customers", endpoint="customersnew"
)
api.add_org_resource(
    CustomersResource, "/api/customers/<customers_id>", endpoint="customers"
)
api.add_org_resource(
    CustomersdeleteResource, "/api/customers/delete/<customers_id>", endpoint="customersdelete"
)
api.add_org_resource(
    CustomerListResource, "/api/customers/list", endpoint="customerslist"
)

api.add_org_resource(
    DepartmentListResource, "/api/department/list", endpoint="departmentlist"
)
api.add_org_resource(
    yusuancodeListResource, "/api/yusuancode/list", endpoint="yusuancodelist"
)
api.add_org_resource(
    CustomerUserListResource, "/api/customeruser/list", endpoint="customeruserlist"
)
api.add_org_resource(
    EmployeeNewResource, "/api/employee", endpoint="employeenew"
)
api.add_org_resource(
    EmployeeResource, "/api/employee/<employee_id>", endpoint="employee"
)
api.add_org_resource(
    EmployeedeleteResource, "/api/employee/delete/<employee_id>", endpoint="employeedelete"
)
api.add_org_resource(
    EmployeeListResource, "/api/employee/list", endpoint="employeelist"
)
api.add_org_resource(
    EmployeeBatchMoveResource, "/api/employee/batchmove", endpoint="employeebatchmove"
)
api.add_org_resource(
    EmployeeSelListResource, "/api/employee/sellist", endpoint="employeesellist"
)
api.add_org_resource(
    EmployeeChangeNewResource, "/api/employeechange", endpoint="employeechangenew"
)
api.add_org_resource(
    EmployeeChangeResource, "/api/employeechange/<employeechange_id>", endpoint="employeechange"
)
api.add_org_resource(
    EmployeeChangeDeleteResource, "/api/employeechange/delete/<employeechange_id>", endpoint="employeechangedelete"
)
api.add_org_resource(
    EmployeeChangeListResource, "/api/employeechange/list", endpoint="employeechangelist"
)

api.add_org_resource(
    EmployeeActivityNewResource, "/api/employeeactivity", endpoint="employeeactivitynew"
)
api.add_org_resource(
    EmployeeActivityResource, "/api/employeeactivity/<employeeactivity_id>", endpoint="employeeactivity"
)
api.add_org_resource(
    EmployeeActivityDeleteResource, "/api/employeeactivity/delete/<employeeactivity_id>", endpoint="employeeactivitydelete"
)
api.add_org_resource(
    EmployeeActivityListResource, "/api/employeeactivity/list", endpoint="employeeactivitylist"
)
api.add_org_resource(
    EmployeeActivityByEmployeeidResource, "/api/employeeactivitybyemployeeid/<employeeid>/<sourcetype>", endpoint="employeeactivitybyemployeeid"
)

api.add_org_resource(
    PaymentNewResource, "/api/payment", endpoint="paymentnew"
)
api.add_org_resource(
    PaymentResource, "/api/payment/<payment_id>", endpoint="payment"
)
api.add_org_resource(
    PaymentdeleteResource, "/api/payment/delete/<payment_id>", endpoint="paymentdelete"
)
api.add_org_resource(
    PaymentListResource, "/api/payment/list", endpoint="paymentlist"
)
api.add_org_resource(
    PaymentUnInListResource, "/api/paymentunin/list", endpoint="paymentuninlist"
)
api.add_org_resource(
    PaymentUnOutListResource, "/api/paymentunout/list", endpoint="paymentunoutlist"
)

api.add_org_resource(
    PaymentActivityNewResource, "/api/paymentactivity", endpoint="paymentactivitynew"
)
api.add_org_resource(
    PaymentActivityResource, "/api/paymentactivity/<paymentactivity_id>", endpoint="paymentactivity"
)
api.add_org_resource(
    PaymentActivityDeleteResource, "/api/paymentactivity/delete/<paymentactivity_id>", endpoint="paymentactivitydelete"
)
api.add_org_resource(
    PaymentActivityListResource, "/api/paymentactivity/list", endpoint="paymentactivitylist"
)
api.add_org_resource(
    PaymentActivityunListResource, "/api/paymentactivity/unlist", endpoint="paymentactivityunlist"
)
api.add_org_resource(
    QueryShowFieldNewResource, "/api/queryshowfield", endpoint="queryshowfieldnew"
)
api.add_org_resource(
    QueryShowFieldResource, "/api/queryshowfield/<queryshowfield_id>", endpoint="queryshowfield"
)
api.add_org_resource(
    QueryShowFieldCodeResource, "/api/queryshowfieldcode/<queryshowfield_code>", endpoint="queryshowfieldcode"
)

api.add_org_resource(
    QueryShowFieldDeleteResource, "/api/queryshowfield/delete/<queryshowfield_id>", endpoint="queryshowfielddelete"
)
api.add_org_resource(
    QueryShowFieldListResource, "/api/queryshowfield/list", endpoint="queryshowfieldlist"
)

api.add_org_resource(
    ProjectNewResource, "/api/project", endpoint="projectnew"
)
api.add_org_resource(
    ProjectResource, "/api/project/<project_id>", endpoint="project"
)
api.add_org_resource(
    ProjectBytstatusResource, "/api/projectbytstatus/<project_id>", endpoint="projectbytstatus"
)

api.add_org_resource(
    ProjectdeleteResource, "/api/project/delete/<project_id>", endpoint="projectdelete"
)
api.add_org_resource(
    ProjectListResource, "/api/project/list", endpoint="projectlist"
)
api.add_org_resource(
    ProjectSelListResource, "/api/project/sellist", endpoint="projectsellist"
)

api.add_org_resource(
    ProjectDetailNewResource, "/api/projectdetail", endpoint="projectdetailnew"
)
api.add_org_resource(
    ProjectDetailResource, "/api/projectdetail/<projectdetail_id>", endpoint="projectdetail"
)
api.add_org_resource(
    ProjectDetaildeleteResource, "/api/projectdetail/delete/<projectdetail_id>", endpoint="projectdetaildelete"
)
api.add_org_resource(
    ProjectDetailListResource, "/api/projectdetail/list", endpoint="projectdetaillist"
)
api.add_org_resource(
    ProjectDetailBatchAddResource, "/api/projectdetailbatchadd", endpoint="projectdetailbatchadd"
)
api.add_org_resource(
    ProjectDetailSelListResource, "/api/projectdetail/sellist", endpoint="projectdetailsellist"
)
api.add_org_resource(
    ProjectDetailEmployeeListResource, "/api/projectdetailemployee/list", endpoint="projectdetailemployeelist"
)
